import axios from '@/utils/request'
import { IActions, IAuditLogParams, IAuditLogResult } from './types/auditLog'
import { IListResult, IPageResult } from './types/base'

// 获取api审计日志
export function getAuditLog(
  currentPage = 1,
  take = 10,
  params: IAuditLogParams,
) {
  return axios<IPageResult<IAuditLogResult>>({
    url: '/api/common/audit-log/list',
    method: 'get',
    params: Object.assign(
      {
        skipCount: take * (currentPage - 1),
        maxResultCount: take,
      },
      params,
    ),
  })
}

// 一次请求触发的接口调用揭露
export function getAuditActionList(auditLogId: string) {
  return axios<IListResult<IActions>>({
    url: '/api/common/audit-log/action-list',
    method: 'get',
    params: {
      auditLogId,
    },
  })
}
